package com.cs.study.homework._0312;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.util.Scanner;

public class Demo2 {
    public static void main(String[] args) throws ClassNotFoundException, NoSuchMethodException, NoSuchFieldException, InstantiationException, IllegalAccessException, InvocationTargetException {
        Class<?> a = Class.forName("com.cs.study.homework._0312.Student");
        Constructor<?> declaredConstructor = a.getDeclaredConstructor(String.class, int.class, int.class);



        Scanner sc = new Scanner(System.in);
        String info = sc.nextLine();
        String[] s = info.split(":");
        Object stu = declaredConstructor.newInstance(s[0], Integer.parseInt(s[1]), Integer.parseInt(s[2]));


        System.out.println(stu);

    }
}

class Student {
    String name;
    int age;
    int score;

    public Student() {
    }

    public Student(String name, int age, int score) {
        this.name = name;
        this.age = age;
        this.score = score;
    }


    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", score=" + score +
                '}';
    }
}


